public class Test10 {

    static int N = 3;
    static char[] a = {'a', 'b', 'c'};
    static boolean[] x = {false, false, false};

    public static void main(String[] args) {
        backTrack(0);
    }

    public static void backTrack(int level) {
        if (level == N) {
            output();
        } else {
            x[level] = false;//不选
            backTrack(level + 1);
            x[level] = true;
            backTrack(level + 1);
        }
    }


    public static void output() {
        System.out.print("{");
        for (int i = 0; i < x.length; i++) {
            if (x[i]) {
                System.out.print(a[i] + " ");
            }
        }
        System.out.print("}");
        System.out.println();
    }
}
